{include file="public/layout" /}

<script type="text/javascript" src="__PUBLIC__/plugins/laydate/laydate.js"></script>



{load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}

{load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}

{load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}



<body style="background-color: #FFF; overflow: auto;min-width:auto;">

<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>

<div id="append_parent"></div>

<div id="ajaxwaitid"></div>

<div class="page" style="min-width:auto;box-shadow:none;">

    <div class="fixed-bar">

        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-chevron-left"></i></a>

            <div class="subject">

                <h3>新增</h3>

                <h5></h5>

            </div>

            <ul class="tab-base nc-row">

                <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>常规选项</span></a></li>

                <li><a href="javascript:void(0);" data-index='2' class="tab"><span>SEO选项</span></a></li>

                <li><a href="javascript:void(0);" data-index='3' class="tab"><span>其他选项</span></a></li>

                <!-- #weapp_diy001_tab# -->

            </ul>

        </div>

    </div>

    <form class="form-horizontal" id="post_form" action="{:url('Custom/add')}" method="post">

        <!-- 常规信息 -->

        <div class="ncap-form-default tab_div_1 tab_div_body">

            <dl class="row">

                <dt class="tit">

                    <label for="title"><em>*</em>标题</label>

                </dt>

                <dd class="opt">

                    <input type="text" name="title" value="" id="title" class="input-txt" maxlength="100">

                    <span class="err"></span>

                    <p class="notic"></p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label for="title"><em>*</em>所属栏目</label>

                </dt>

                <dd class="opt"> 

                    <select name="typeid" id="typeid">

                        <option value="0">请选择栏目…</option>

                        {$arctype_html}

                    </select>

                    <span class="err"></span>

                    <p class="notic">谨慎切换，自定义字段的内容会随着栏目切换而清空，在保存之前不受影响！</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label>文档属性</label>

                </dt>

                <dd class="opt">

                    <label><input type="checkbox" name="is_head" value="1">头条[h]</label>&nbsp;

                    <label><input type="checkbox" name="is_recom" value="1">推荐[c]</label>&nbsp;

                    <label><input type="checkbox" name="is_special" value="1">特荐[a]</label>&nbsp;

                    <label><input type="checkbox" name="is_b" value="1">加粗[b]</label>&nbsp;

                    <label><input type="checkbox" name="is_litpic" value="1">图片[p]</label>&nbsp;

                    <label><input type="checkbox" name="is_jump" value="1">跳转[j]</label>&nbsp;

                    <span class="err"></span>

                    <p class="notic"></p>

                </dd>

            </dl>

            <dl class="row none dl_jump">

                <dt class="tit">

                    <label>跳转网址</label>

                </dt>

                <dd class="opt">

                    <input type="text" value="" name="jumplinks" id="jumplinks" class="input-txt" placeholder="http://">

                    <span class="err"></span>

                    <p class="notic">请输入完整的URL网址（包含http或https），设置后访问该条信息将直接跳转到设置的网址</p>

                </dd>

            </dl>

            {if condition="!empty($channelfield_row['litpic']) AND 1 == $channelfield_row['litpic']['ifeditable']"}

            <dl class="row">

                <dt class="tit">

                  <label>多图上传</label>

                </dt>

                <dd class="opt">

                    <div class="input-file-show div_litpic_local">

                        <span class="show">

                            <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="javascript:void(0);">

                                <i id="img_i" class="fa fa-picture-o" onmouseover="" onmouseout="layer.close(layer_tips);"></i>

                            </a>

                        </span>

                        <span class="type-file-box">

                            <input type="text" id="litpic_local" name="litpic_local" value="" class="type-file-text">

                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">

                            <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo"

                                 title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">

                        </span>

                    </div>

                    <input type="text" id="litpic_remote" name="litpic_remote" value="" placeholder="http://" class="input-txt" onKeyup="keyupRemote(this, 'litpic');" style="display: none;">

                    &nbsp;

                    <label><input type="checkbox" name="is_remote" id="is_remote" value="1" onClick="clickRemote(this, 'litpic');">远程图片</label>

                    <span class="err"></span>

                    <p class="notic">当没有手动上传图片时候，会自动提取相册的第一张图片作为封面</p>

                    &nbsp;<a href="javascript:void(0);" onclick="system_thumb();" class="ncap-btn ncap-btn-green">缩略图配置</a>

                </dd>

            </dl>

            {/if}



            {include file="archives/get_field_addonextitem" /}

        </div>

        <!-- 常规信息 -->

        <!-- SEO设置 -->

        <div class="ncap-form-default tab_div_2 tab_div_body" style="display:none;">

            <dl class="row">

                <dt class="tit">

                    <label>TAG标签</label>

                </dt>

                <dd class="opt opt1591870121">

                    <input type="text" name="tags" id="tags" class="input-txt">

                    <script type="text/javascript">

                        $(function() { $('#tags').tagsInput({width: '450px', height: 'auto'}); });

                    </script>

                    <a href="javascript:void(0);" onclick="TagListSelect1591784354(this);" class="ncap-btn ncap-btn-green">快速选择</a>

                    <span class="err"></span>

                    <p class="notic">输入标签结束后可用回车或空格分开</p>

                    <input type="hidden" id="TagOldSelectID">

                    <input type="hidden" id="NewTagOldSelectID">

                    <input type="hidden" id="TagOldSelectTag">

                    <input type="hidden" name="tags_new" id="NewTagOldSelectTag">

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label for="seo_title">SEO标题</label>

                </dt>

                <dd class="opt">

                    <input type="text" value="" name="seo_title" id="seo_title" class="input-txt">

                    <p class="notic">一般不超过80个字符，为空时系统自动构成，可以到 <a href="{:url('Seo/index', array('inc_type'=>'seo'))}">SEO设置 - SEO基础</a> 中设置构成规则。</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label>SEO关键词</label>

                </dt>

                <dd class="opt">          

                    <textarea rows="5" cols="60" id="seo_keywords" name="seo_keywords" style="height:40px;"></textarea>

                    <span class="err"></span>

                    <p class="notic">一般不超过100个字符，多个关键词请用英文逗号（,）隔开，建议3到5个关键词。</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label>SEO描述</label>

                </dt>

                <dd class="opt">          

                    <textarea rows="5" cols="60" id="seo_description" name="seo_description" style="height:60px;"></textarea>

                    <span class="err"></span>

                    <p class="notic">一般不超过200个字符，不填写时系统自动提取正文的前200个字符</p>

                </dd>

            </dl>

        </div>

        <!-- SEO设置 -->

        <!-- 其他参数 -->

        <div class="ncap-form-default tab_div_3 tab_div_body" style="display:none;">

            {if condition="!empty($channelfield_row['author']) AND 1 == $channelfield_row['litpic']['ifeditable']"}

            <dl class="row">

                <dt class="tit">

                    <label for="author">作者</label>

                </dt>

                <dd class="opt">

                    <input type="text" value="{$Think.session.admin_info.pen_name|default='小编'}" name="author" id="author" class="input-txt">

                    &nbsp;<a href="javascript:void(0);" onclick="set_author();" class="ncap-btn ncap-btn-green">设置</a>

                    <p class="notic">设置作者默认名称（将同步至管理员笔名）</p>

                </dd>

            </dl>

            {/if}

            <dl class="row">

                <dt class="tit">

                    <label>浏览量</label>

                </dt>

                <dd class="opt">    

                    <input type="text" value="{php}echo mt_rand(100, 300);{/php}" name="click" id="click" class="input-txt">

                    <span class="err"></span>

                    <p class="notic"></p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label>阅读权限</label>

                </dt>

                <dd class="opt">

                    <select name="arcrank" id="arcrank">

                        {volist name="arcrank_list" id="vo"}

                        <option value="{$vo.rank}">{$vo.name}</option>

                        {/volist}

                    </select>    

                    <span class="err"></span>

                    <p class="notic"></p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label for="articleForm">发布时间</label>

                </dt>

                <dd class="opt">

                    <input type="text" class="input-txt" id="add_time" name="add_time" value="{php}echo date('Y-m-d H:i:s'){/php}" autocomplete="off">        

                    <span class="add-on input-group-addon">

                        <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>

                    </span> 

                    <span class="err"></span>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label for="tempview">文档模板</label>

                </dt>

                <dd class="opt">

                    <select name="tempview" id="tempview">

                        {volist name='$templateList' id='vo'}

                        <option value="{$vo}" {eq name='$vo' value='$tempview'}selected{/eq}>{$vo}</option>

                        {/volist}

                    </select>

                    <input type="hidden" name="type_tempview" value="{$tempview}" />

                    <span class="err"></span>

                </dd>

            </dl>

            <dl class="row" {neq name='$seo_pseudo' value='2'}style="display: none;"{/neq}>

                <dt class="tit">

                    <label>自定义文件名</label>

                </dt>

                <dd class="opt">

                    <input type="text" value="" name="htmlfilename" id="htmlfilename" style="width: 120px;" onkeyup="this.value=this.value.replace(/[^\w\-]/g,'');" onpaste="this.value=this.value.replace(/[^\w\-]/g,'');">.html

                    <span class="err"></span>

                    <p class="notic">自定义文件名可由字母/数字/'_'/'-'等符号组成</p>

                </dd>

            </dl>

        </div>

        <!-- 其他参数 -->



        <!-- #weapp_diy001_body# -->



        <div class="ncap-form-default">

            <div class="bot">

                <input type="hidden" name="gourl" value="{$gourl}">

                <input type="hidden" name="channel" value="{$Request.param.channel}">

                <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>

            </div>

        </div> 

    </form>

</div>

<script type="text/javascript">



    $(function () {

        $('#add_time').layDate();   

     

        //选项卡切换列表

        $('.tab-base').find('.tab').click(function(){

            $('.tab-base').find('.tab').each(function(){

                $(this).removeClass('current');

            });

            $(this).addClass('current');

            var tab_index = $(this).data('index');

            $(".tab_div_body").hide();          

            $(".tab_div_"+tab_index).show();

        });



        $('input[name=is_jump]').click(function(){

            if ($(this).is(':checked')) {

                $('.dl_jump').show();

            } else {

                $('.dl_jump').hide();

            }

        });



        var dftypeid = {$typeid|default='0'};

        $('#typeid').change(function(){

            var current_channel = $(this).find('option:selected').data('current_channel');

            if (0 < $(this).val() && {$channeltype} != current_channel) {

                showErrorMsg('请选择对应模型的栏目！');

                $(this).val(dftypeid);

            } else if ({$channeltype} == current_channel) {

                layer.closeAll();

            }

            GetAddonextitem(1, $(this).val(), {$channeltype}, 0, true, 'Custom');

        });

    });



    function set_author()

    {

        layer.prompt({

                title:'<font color="red">设置作者默认名称</font>'

            },

            function(val, index){

                var admin_id = '{$Think.session.admin_info.admin_id}';

                $.ajax({

                    url: "{:url('Admin/ajax_setfield', ['_ajax'=>1])}",

                    type: 'POST',

                    dataType: 'JSON',

                    data: {id_name:'admin_id',id_value:admin_id,field:'pen_name',value:val},

                    success: function(res){

                        if (res.code == 1) {

                            $('#author').val(val);

                            layer.msg(res.msg, {icon: 1, time:1000});

                        } else {

                            showErrorMsg(res.msg);

                            return false;

                        }

                    },

                    error: function(e){

                        showErrorMsg(ey_unknown_error);

                        return false;

                    }

                });

                layer.close(index);

            }

        );

    }



    function tags_list(obj)

    {

        layer.closeAll();

        var url = "{:url('Tags/index')}";

        //iframe窗

        var iframes = layer.open({

            type: 2,

            title: 'TAG标签管理',

            fixed: true, //不固定

            shadeClose: false,

            content: url

        });



        layer.full(iframes);

    }



    function system_thumb()

    {

        var url = "{:url('System/thumb', ['tabase'=>-1])}";

        //iframe窗

        var iframes = layer.open({

            type: 2,

            title: '缩略图配置',

            fixed: true, //不固定

            shadeClose: false,

            shade: 0.3,

            content: url

        });

        layer.full(iframes);

    }



    // 判断输入框是否为空

    function check_submit(){

        if($.trim($('input[name=title]').val()) == ''){

            showErrorMsg('标题不能为空！');

            $($('.tab-base').find('.tab')[0]).trigger('click'); 

            $('input[name=title]').focus();

            return false;

        }

        if ($('#typeid').val() == 0) {

            showErrorMsg('请选择栏目…！');

            $($('.tab-base').find('.tab')[0]).trigger('click'); 

            $('#typeid').focus();

            return false;

        }

        layer_loading('正在处理');

        $('#post_form').submit();

    }



    function img_call_back(fileurl_tmp)

    {

        $("#litpic_local").val(fileurl_tmp);

        $("#img_a").attr('href', fileurl_tmp);

        $("#img_i").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");

        $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]

    }

</script>



{include file="public/footer" /}